(library (list-helpers)
  (export flatten
          make-list)

  (import
   (except (rnrs base) let-values map error)
   (only (guile)
         lambda* λ))


  (define flatten
    (λ (lst)
      (cond [(null? lst) '()]
            [(pair? lst)
             (append (flatten (car lst))
                     (flatten (cdr lst)))]
            [else
             (list lst)])))


  (define make-list
    (λ (val count)
      (cond
       [(> count 0)
        (cons val (make-list val (- count 1)))]
       [else '()]))))
